﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using EveMarketsDAO;

namespace EveMarkets.UserControls
{
	/// <summary>
	/// Logique d'interaction pour UcChoixItem.xaml
	/// </summary>
	public partial class UcChoixItem : UserControl
	{
		public UcChoixItem()
		{
			InitializeComponent();
		}

		/// <summary>
		/// Vérification du nom de l'item écrit.
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void CheckNomItem(object sender, RoutedEventArgs e)
		{
			// Si le mot clé Tout est sélectionné, tout est OK.
			if(txtBoxNomItem.Text.Equals("Tout"))
			{
				imgRight.Visibility = Visibility.Visible;
				imgWrong.Visibility = Visibility.Hidden;

				return;
			}

			var itemTeste = ContexteDAO.VerifiePresenceDeLitem(txtBoxNomItem.Text);

			if (itemTeste)
			{
				imgRight.Visibility = Visibility.Visible;
				imgWrong.Visibility = Visibility.Hidden;
			}
			else
			{
				imgRight.Visibility = Visibility.Hidden;
				imgWrong.Visibility = Visibility.Visible;
			}
		}
	}
}
